package com.butuh.uang.tuh.ang.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.butuh.uang.tuh.ang.R;
import com.butuh.uang.tuh.ang.model.HomeListBean;

import cn.droidlover.xdroidmvp.base.XListAdapter;
import cn.droidlover.xdroidmvp.kit.Kits;

public class DownHistoryAdapter extends XListAdapter<HomeListBean> {

    public DownHistoryAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHloder viewHloder;
        if (convertView == null) {
            viewHloder = new ViewHloder();
            convertView = LayoutInflater.from(context).inflate(R.layout.item_down_history, null);
            viewHloder.iv_logo=convertView.findViewById(R.id.iv_logo);
            viewHloder.tv_time=convertView.findViewById(R.id.tv_time);
            viewHloder.tv_message=convertView.findViewById(R.id.tv_message);
            convertView.setTag(viewHloder);
        } else {
            viewHloder = (ViewHloder) convertView.getTag();

        }
        HomeListBean bean=data.get(position);
        Glide.with(context).load(bean.getIdentification()).into(viewHloder.iv_logo);
        viewHloder.tv_message.setText(bean.getDesignation());
        viewHloder.tv_time.setText(Kits.Date.getHmDmy(bean.getRenovate()));

        return convertView;
    }

    class ViewHloder {
        ImageView iv_logo;
        TextView tv_time;
        TextView tv_message;
    }

}
